package cn.wolfcode.mq;

import cn.wolfcode.web.controller.OrderInfoController;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author LuoRis
 * @date 2021/03/08 21:23
 * @description 广播队列
 */
@RocketMQMessageListener(
        topic = MQConstant.CANCEL_SECKILL_OVER_SIGE_TOPIC,
        consumerGroup = "MQLoadFlagListener",
        messageModel = MessageModel.BROADCASTING
)
@Component
@Slf4j
public class MQLoadFlagListener implements RocketMQListener<Long> {


    @Override
    public void onMessage(Long seckillId) {
        log.info("-----进入到广播队列中-----");
        OrderInfoController.LOCAL_FLAG.put(seckillId,false);

    }
}
